<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>

<script>

    $(function() {
        init();
        searchAction();
        dataListInit();
    })

	function init(){

        $('.form_date').datetimepicker({
            format: 'yyyy-mm',
            autoclose: true,
            todayBtn: true,
            startView: 'year',
            minView:'year',
            maxView:'decade',
            language:  'zh-CN',
        });

        var teachers = '${teachers}';
        var teacher = '<option value="">--请选择--</option>'+teachers;
        $("#teacherSearch").html(teacher);
	}
    // 搜索动作
    function searchAction() {
        $('#search_button').click(function() {
            search_keyWord = $('#search_input').val();
            tableRefresh();
        })
    }

    // 分页查询参数
    function queryParams(params) {

        var temp = {
            limit : params.limit,
            offset : params.offset,
            teacherName:$('#teacherSearch').val(),
            time:$('#timeSearch').val(),
        }
        return temp;
    }

    // 表格初始化
    function dataListInit() {
        $('#dataList').bootstrapTable(
            {
                columns : [{
                    checkbox: true,
                    align: 'center'
                }, {
                    title: 'ID',
                    formatter: function (value, row, index) {
                        return index+1;
                    },
                    align: "center"
                },
                    {
                        field : 'teacher_name',
                        title : '教师姓名'
                    },
                    {
                        field : 'counts',
                        title : '总课时'
                    }],
                url : '/onlineEdu/teacher/getTeacherLessonStatistics',
                onLoadError:function(status){
                    handleAjaxError(status);
                },
                method : 'GET',
                queryParams : queryParams,
                sidePagination : "server",
                dataType : 'json',
                pagination : true,
                pageNumber : 1,
                pageSize: 10,
                pageList : [5, 10, 25, 50, 100 ],
                clickToSelect : true
            });
    }
    // 表格刷新
    function tableRefresh() {
        $('#dataList').bootstrapTable('refresh', {
            query : {}
        });
    }

</script>
<div class="panel panel-default">
	<ol class="breadcrumb">
		<li><label class="form-label">课时统计</label></li>
	</ol>
	<div class="panel-body">
		<div class="row">
			<div style="width: 100%;margin-top: -16px" class="box-content">
				<table id="信息查询" class="table table-bordered table-hover table-responsive">
					<tbody>
					<tr>
						<td class="item-title" align="center">姓名</td>
						<td class="item-content-half">
							<select id="teacherSearch" class="form-control">
							</select>
						</td>
						<td class="item-title" align="center">时间</td>
						<td class="item-content-half" style="text-align: left">
							<input type="text" style="width: 130px;display: inline-block" class="form_date form-control" id="timeSearch" placeholder="">
						</td>
					</tr>
					</tbody>
				</table>
			</div>

			<%--</div>--%>
		</div>
		<div style="text-align: right">
			<button id="search_button" style="text-align: right" class="btn btn-success">
				<span class="glyphicon glyphicon-search"></span> <span>查询</span>
			</button>
		</div>
	</div>
	<div class="row" style="margin-top: 15px">
		<div class="col-md-12">
			<table id="dataList" class="table table-striped"></table>
		</div>
	</div>
</div>
</div>

